package c2.cross.business.rank;

import c2.advanced.business.base.AdvancedDaoTemplate;
import c2.cross.business.rank.data.CrossGuildRankData;
import c2.cross.business.rank.data.CrossRankData;
import c2.cross.share.DbFacade4Cross;
import easy.java.dev.note.NoteClass;


@NoteClass("跨服排行榜数据")
public class CrossRankDao extends AdvancedDaoTemplate {
    public static final String COLLECTION = "cross-rank";

    public CrossRankDao(DbFacade4Cross root) {
        super(root);
    }

    public <T extends CrossRankData> T getByKey(String key, Class<T> dataClz) {
        return mongo().findById(key, dataClz, COLLECTION);
    }

    public <T extends CrossRankData> T save(T data) {
        return mongo().save(data, COLLECTION);
    }

    public CrossGuildRankData getGuild(String key) {
        return mongo().findById(key, CrossGuildRankData.class, COLLECTION);
    }

    public void saveGuild(CrossGuildRankData data) {
        mongo().save(data, COLLECTION);
    }
}
